<?php
	/*
	*	Helper functions
	*/
	
	function base_url() {
		$conf = new Config();
		return $conf->item('base_url');
	}
	function url($route, $params=array()) {
		$conf = new Config();
		$baseUrl = $conf->item('base_url') . $conf->item('index_page') .'/';
		$baseUrl .= $route .'/'. implode('/', $params);
		return $baseUrl;	
	}
	function redirect($route, $params=array()) {
		$url = url($route, $params);
		header("location: $url");
	}
	function mdEncrypt($str) {
		return md5($str);
	}
	function arrayToNumericIndex($arr = array()) {
		$newArr = array();
		if(count($arr) < 1)
			return $newArr;
		foreach($arr as $item) {
			$newArr[] = $item; 
		}
		return $newArr;
	}
?>